'\" et
.TH sched.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
sched.h
\(em execution scheduling
.SH SYNOPSIS
.LP
.nf
#include <sched.h>
.fi
.SH DESCRIPTION
The
.IR <sched.h> 
header shall define the
.BR pid_t
type as described in
.IR <sys/types.h> .
.P
The
.IR <sched.h> 
header shall define the
.BR time_t
type as described in
.IR <sys/types.h> .
.P
The
.IR <sched.h> 
header shall define the
.BR timespec
structure as described in
.IR <time.h> .
.P
The
.IR <sched.h> 
header shall define the
.BR sched_param
structure, which shall include the scheduling parameters required for
implementation of each supported scheduling policy. This structure
shall include at least the following member:
.sp
.RS 4
.nf

int       sched_priority        \fRProcess or thread execution scheduling priority.\fP
.fi
.P
.RE
.P
The
.BR sched_param
structure defined in
.IR <sched.h> 
shall include the following members in addition to those specified
above:
.sp
.RS 4
.nf

int             sched_ss_low_priority \fRLow scheduling priority for\fR
                                      \fRsporadic server.\fR
struct timespec sched_ss_repl_period  \fRReplenishment period for\fR
                                      \fRsporadic server.\fR
struct timespec sched_ss_init_budget  \fRInitial budget for sporadic server.\fR
int             sched_ss_max_repl     \fRMaximum pending replenishments for\fR
                                      \fRsporadic server.\fR
.fi
.P
.RE
.P
Each process or thread is controlled by an associated scheduling policy
and priority. Associated with each policy is a priority range. Each
policy definition specifies the minimum priority range for that
policy. The priority ranges for each policy may overlap the priority
ranges of other policies.
.P
Four scheduling policies are defined; others may be defined by the
implementation. The four standard policies are indicated by the
values of the following symbolic constants:
.IP SCHED_FIFO 14
First in-first out (FIFO) scheduling policy.
.IP SCHED_RR 14
Round robin scheduling policy.
.IP SCHED_SPORADIC 14
Sporadic server scheduling policy.
.IP SCHED_OTHER 14
Another scheduling policy.
.P
The values of these constants are distinct.
.P
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS 4
.nf

int    sched_get_priority_max(int);
int    sched_get_priority_min(int);
int    sched_getparam(pid_t, struct sched_param *);
int    sched_getscheduler(pid_t);
int    sched_rr_get_interval(pid_t, struct timespec *);
int    sched_setparam(pid_t, const struct sched_param *);
int    sched_setscheduler(pid_t, int, const struct sched_param *);
int    sched_yield(void);
.fi
.P
.RE
.P
Inclusion of the
.IR <sched.h> 
header may make visible all symbols from the
.IR <time.h> 
header.
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
None.
.SH RATIONALE
None.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "\fB<sys_types.h>\fP",
.IR "\fB<time.h>\fP"
.P
The System Interfaces volume of POSIX.1\(hy2017,
.IR "\fIsched_get_priority_max\fR\^(\|)",
.IR "\fIsched_getparam\fR\^(\|)",
.IR "\fIsched_getscheduler\fR\^(\|)",
.IR "\fIsched_rr_get_interval\fR\^(\|)",
.IR "\fIsched_setparam\fR\^(\|)",
.IR "\fIsched_setscheduler\fR\^(\|)",
.IR "\fIsched_yield\fR\^(\|)"
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
